package com.example.test.controller;


import com.example.test.bean.UserBean;
import com.example.test.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

@Controller
public class LoginController {

    @Resource
    UserService userService;

    @RequestMapping("/login")
    public String show(){
        return"login";
    }

    @RequestMapping(value = "/loginAction",method = RequestMethod.POST)
    public String loginAction(String name,String password) {
        UserBean userBean = userService.loginAction(name, password);
        if (userBean == null) {
            return "error";
        } else {
            return "success";
        }
    }
}
